package com.quarantine.web;


import java.util.List;

import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springside.modules.orm.Page;

import com.quarantine.model.announcement;
import com.quarantine.model.fileupload;
import com.quarantine.model.member;
import com.quarantine.model.newsphoto;
import com.quarantine.model.trends;
import com.quarantine.service.AnnouncementManager;
import com.quarantine.service.FileUploadManager;
import com.quarantine.service.MemberManager;
import com.quarantine.service.NewsphotoManager;
import com.quarantine.service.TrendsManager;
@Namespace("/base")
public class IndexAction extends CrudActionSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = 3420006191855210080L;
	private AnnouncementManager announcementmanager;
	private Page<announcement> announcementPage = new Page<announcement>();
	private TrendsManager trendsmanager;
	private Page<trends> trendsPage = new Page<trends>();
	private NewsphotoManager newsphotomanager;
	private Page<newsphoto> newsphotoPage = new Page<newsphoto>();
	private FileUploadManager filemanager;
	private Page<fileupload> filePage = new Page<fileupload>();
	private List<trends> trendsList;
	private List<newsphoto> newsphotoList;
	private List<announcement> announcementList;
	private List<fileupload> filesList;
	private MemberManager membermanager;
	private Page<member> memberPage = new Page<member>();
	private List<member> memberList0;
	private List<member> memberList1;
	private List<member> memberList2;
	private List<member> memberList3;
	private List<member> memberList4;
	public AnnouncementManager getAnnouncementmanager() {
		return announcementmanager;
	}
	@Autowired
	public void setAnnouncementmanager(AnnouncementManager announcementmanager) {
		this.announcementmanager = announcementmanager;
	}

	public Page<announcement> getAnnouncementPage() {
		return announcementPage;
	}

	public void setAnnouncementPage(Page<announcement> announcementPage) {
		this.announcementPage = announcementPage;
	}

	public TrendsManager getTrendsmanager() {
		return trendsmanager;
	}
	@Autowired
	public void setTrendsmanager(TrendsManager trendsmanager) {
		this.trendsmanager = trendsmanager;
	}

	public Page<trends> getTrendsPage() {
		return trendsPage;
	}

	public void setTrendsPage(Page<trends> trendsPage) {
		this.trendsPage = trendsPage;
	}

	public NewsphotoManager getNewsphotomanager() {
		return newsphotomanager;
	}
	@Autowired
	public void setNewsphotomanager(NewsphotoManager newsphotomanager) {
		this.newsphotomanager = newsphotomanager;
	}

	public Page<newsphoto> getNewsphotoPage() {
		return newsphotoPage;
	}

	public void setNewsphotoPage(Page<newsphoto> newsphotoPage) {
		this.newsphotoPage = newsphotoPage;
	}

	@Override
	public Object getModel() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String list() throws Exception {
	
		trendsPage.setPageSize(6);
		trendsPage = trendsmanager.getList(trendsPage);
		setTrendsList(trendsPage.getResult());
		announcementPage.setPageSize(6);
		announcementPage = announcementmanager.getList(announcementPage);
		setAnnouncementList(announcementPage.getResult());
		newsphotoPage.setPageSize(6);
		newsphotoPage = newsphotomanager.getList(newsphotoPage);
		setNewsphotoList(newsphotoPage.getResult());
		filePage.setPageSize(6);
		filePage = filemanager.getList(filePage);
		setFilesList(filePage.getResult());
		memberPage.setPageSize(6);
	    memberPage = membermanager.getList4(memberPage);
		setMemberList4(memberPage.getResult());
		memberPage = membermanager.getList3(memberPage);
		setMemberList3(memberPage.getResult());
		memberPage = membermanager.getList2(memberPage);
		setMemberList2(memberPage.getResult());
		memberPage = membermanager.getList1(memberPage);
		setMemberList1(memberPage.getResult());
		memberPage = membermanager.getall(memberPage);
		setMemberList0(memberPage.getResult());
		return "list";
	}

	@Override
	public String input() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String save() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String delete() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected void prepareModel() throws Exception {
		// TODO Auto-generated method stub
		
	}
	public List<trends> getTrendsList() {
		return trendsList;
	}
	public void setTrendsList(List<trends> trendsList) {
		this.trendsList = trendsList;
	}
	public List<newsphoto> getNewsphotoList() {
		return newsphotoList;
	}
	public void setNewsphotoList(List<newsphoto> newsphotoList) {
		this.newsphotoList = newsphotoList;
	}
	public List<announcement> getAnnouncementList() {
		return announcementList;
	}
	public void setAnnouncementList(List<announcement> announcementList) {
		this.announcementList = announcementList;
	}
	public FileUploadManager getFilemanager() {
		return filemanager;
	}
	public MemberManager getMembermanager() {
		return membermanager;
	}
	@Autowired
	public void setMembermanager(MemberManager membermanager) {
		this.membermanager = membermanager;
	}
	public Page<member> getMemberPage() {
		return memberPage;
	}
	public void setMemberPage(Page<member> memberPage) {
		this.memberPage = memberPage;
	}
	public List<member> getMemberList0() {
		return memberList0;
	}
	public void setMemberList0(List<member> memberList0) {
		this.memberList0 = memberList0;
	}
	public List<member> getMemberList1() {
		return memberList1;
	}
	public void setMemberList1(List<member> memberList1) {
		this.memberList1 = memberList1;
	}
	public List<member> getMemberList2() {
		return memberList2;
	}
	public void setMemberList2(List<member> memberList2) {
		this.memberList2 = memberList2;
	}
	public List<member> getMemberList3() {
		return memberList3;
	}
	public void setMemberList3(List<member> memberList3) {
		this.memberList3 = memberList3;
	}
	public List<member> getMemberList4() {
		return memberList4;
	}
	public void setMemberList4(List<member> memberList4) {
		this.memberList4 = memberList4;
	}
	@Autowired
	public void setFilemanager(FileUploadManager filemanager) {
		this.filemanager = filemanager;
	}
	public Page<fileupload> getFilePage() {
		return filePage;
	}
	public void setFilePage(Page<fileupload> filePage) {
		this.filePage = filePage;
	}
	public List<fileupload> getFilesList() {
		return filesList;
	}
	public void setFilesList(List<fileupload> filesList) {
		this.filesList = filesList;
	}


}
